package controller.api;
import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Kv;

import common.inter.StaffStationInter;
import model.RunRecords;
import service.RunRecordsService;

public class ApiRunRecordsController extends BaseApiController {
	@Inject RunRecordsService runRecordsService ;

	public void list() {
	    Kv kv = getParamKv() ;
	    Integer pageNumber = getParaToInt("pageNumber", 1);
	    Integer pageSize = getParaToInt("pageSize", 10);
	    set("page", runRecordsService.getApiPage( kv , pageNumber, pageSize));
	    renderJson();
	}
	
	@Before(StaffStationInter.class)
	public void save() {
		RunRecords runRecords = getModel(RunRecords.class,"",true);
		renderJson( runRecordsService.save(runRecords ,  getStaff() , getStation() ) );
	}
}
